70025d765b044c6d8594bb965a2247a61e991a99johnny * CDDL HEADER START
70025d765b044c6d8594bb965a2247a61e991a99johnny * The contents of this file are subject to the terms of the
70025d765b044c6d8594bb965a2247a61e991a99johnny * Common Development and Distribution License, Version 1.0 only
70025d765b044c6d8594bb965a2247a61e991a99johnny * (the "License"). You may not use this file except in compliance
70025d765b044c6d8594bb965a2247a61e991a99johnny * with the License.
70025d765b044c6d8594bb965a2247a61e991a99johnny * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
70025d765b044c6d8594bb965a2247a61e991a99johnny * See the License for the specific language governing permissions
70025d765b044c6d8594bb965a2247a61e991a99johnny * and limitations under the License.
70025d765b044c6d8594bb965a2247a61e991a99johnny * When distributing Covered Code, include this CDDL HEADER in each
70025d765b044c6d8594bb965a2247a61e991a99johnny * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
70025d765b044c6d8594bb965a2247a61e991a99johnny * If applicable, add the following below this CDDL HEADER, with the
70025d765b044c6d8594bb965a2247a61e991a99johnny * fields enclosed by brackets "[]" replaced with your own identifying
70025d765b044c6d8594bb965a2247a61e991a99johnny * information: Portions Copyright [yyyy] [name of copyright owner]
70025d765b044c6d8594bb965a2247a61e991a99johnny * CDDL HEADER END
70025d765b044c6d8594bb965a2247a61e991a99johnny * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
70025d765b044c6d8594bb965a2247a61e991a99johnny * Use is subject to license terms.
70025d765b044c6d8594bb965a2247a61e991a99johnny * misc config_admin(3cfgadm) related routines
70025d765b044c6d8594bb965a2247a61e991a99johnnystatic struct {
70025d765b044c6d8594bb965a2247a61e991a99johnny sizeof (pcidr_cfga_stat_nametab) / sizeof (pcidr_cfga_stat_nametab[0]);
70025d765b044c6d8594bb965a2247a61e991a99johnny for (i = 0; i < pcidr_cfga_stat_nametab_len; i++) {
70025d765b044c6d8594bb965a2247a61e991a99johnnystatic struct {
70025d765b044c6d8594bb965a2247a61e991a99johnny sizeof (pcidr_cfga_cmd_nametab) / sizeof (pcidr_cfga_cmd_nametab[0]);
70025d765b044c6d8594bb965a2247a61e991a99johnny for (i = 0; i < pcidr_cfga_cmd_nametab_len; i++) {
70025d765b044c6d8594bb965a2247a61e991a99johnnystatic struct {
70025d765b044c6d8594bb965a2247a61e991a99johnny sizeof (pcidr_cfga_cond_nametab) / sizeof (pcidr_cfga_cond_nametab[0]);
70025d765b044c6d8594bb965a2247a61e991a99johnny for (i = 0; i < pcidr_cfga_cond_nametab_len; i++) {
70025d765b044c6d8594bb965a2247a61e991a99johnnystatic struct {
70025d765b044c6d8594bb965a2247a61e991a99johnny {CFGA_INSUFFICENT_CONDITION, "CFGA_INSUFFICENT_CONDITION"},
70025d765b044c6d8594bb965a2247a61e991a99johnny sizeof (pcidr_cfga_err_nametab) / sizeof (pcidr_cfga_err_nametab[0]);
70025d765b044c6d8594bb965a2247a61e991a99johnny for (i = 0; i < pcidr_cfga_err_nametab_len; i++) {
70025d765b044c6d8594bb965a2247a61e991a99johnnypcidr_print_cfga(dlvl_t lvl, cfga_list_data_t *datap, char *prestr)
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(lvl, "%slogical APID = %s\n", prestr, datap->ap_log_id);
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(lvl, "%sphyiscal APID = %s\n", prestr, datap->ap_phys_id);
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(lvl, "%sAP class = %s\n", prestr, datap->ap_class);
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(lvl, "%sAP receptacle state = %s\n", prestr, str);
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(lvl, "%sAP occupant state = %s\n", prestr, str);
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(lvl, "%sAP busy indicator = %d\n", prestr, datap->ap_busy);
70025d765b044c6d8594bb965a2247a61e991a99johnny str[strlen(str) - 1] = '\0'; /* get rid of newline */
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(lvl, "%sAP last change time = %ld (%s)\n", prestr,
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(lvl, "%sAP info = %s\n", prestr, datap->ap_info);
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(lvl, "%sAP type = %s\n", prestr, datap->ap_type);
70025d765b044c6d8594bb965a2247a61e991a99johnny * for use with config_admin(3cfgadm) functions in their
70025d765b044c6d8594bb965a2247a61e991a99johnny * <struct cfga_msg *msgp> parameter
70025d765b044c6d8594bb965a2247a61e991a99johnny pcidr_cfga_msg_data_t *dp = (pcidr_cfga_msg_data_t *)datap;
70025d765b044c6d8594bb965a2247a61e991a99johnny return (0);
70025d765b044c6d8594bb965a2247a61e991a99johnny * for use with config_admin(3cfgadm) functions in their
70025d765b044c6d8594bb965a2247a61e991a99johnny * <struct cfga_confirm *confp> parameter
70025d765b044c6d8594bb965a2247a61e991a99johnny/*ARGSUSED*/
70025d765b044c6d8594bb965a2247a61e991a99johnny return (1);
70025d765b044c6d8594bb965a2247a61e991a99johnny * returns 0 if successful, -1 if unusuccesful, 1 if the AP already had
70025d765b044c6d8594bb965a2247a61e991a99johnny * <cmd> performed on it
70025d765b044c6d8594bb965a2247a61e991a99johnnypcidr_cfga_do_cmd(cfga_cmd_t cmd, cfga_list_data_t *cfga_listp)
70025d765b044c6d8594bb965a2247a61e991a99johnny int cmdarr_len = sizeof (cmdarr) / sizeof (cmdarr[0]);
70025d765b044c6d8594bb965a2247a61e991a99johnny return (-1);
70025d765b044c6d8594bb965a2247a61e991a99johnny * explicitly perform each step that would otherwise be done
70025d765b044c6d8594bb965a2247a61e991a99johnny * implicitly by cfgadm to isolate errors
70025d765b044c6d8594bb965a2247a61e991a99johnny if (cfga_listp->ap_o_state >= CFGA_STAT_CONFIGURED) {
70025d765b044c6d8594bb965a2247a61e991a99johnny if (cfga_listp->ap_r_state <= CFGA_STAT_DISCONNECTED)
70025d765b044c6d8594bb965a2247a61e991a99johnny return (-1);
70025d765b044c6d8594bb965a2247a61e991a99johnny for (i = 0; i < j; i++) {
70025d765b044c6d8594bb965a2247a61e991a99johnny rv = config_change_state(cmd, 1, &apid, NULL, &cfga_confirm,
70025d765b044c6d8594bb965a2247a61e991a99johnny return (-1);
70025d765b044c6d8594bb965a2247a61e991a99johnny return (0);
70025d765b044c6d8594bb965a2247a61e991a99johnny /*NOTREACHED*/
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(DDEBUG, "%s: command %s already done on apid %s\n",
70025d765b044c6d8594bb965a2247a61e991a99johnny return (1);